package fr.univnantes.lina.ftbcleaner;

import org.w3c.dom.Element;

import fr.univnantes.lina.ftbcleaner.WordAttributes;
import fr.univnantes.lina.mlnlp.connectors.ftb.FTBXMLSchema;

/**
 * 
 * @author hernandez
 *
 */
class WordAttributes {
	/**
	 * @return the word
	 */
	protected String getWord() {
		return word;
	}
	/**
	 * @param word the word to set
	 */
	protected void setWord(String word) {
		this.word = word;
	}
	/**
	 * @return the cat
	 */
	protected String getCat() {
		return cat;
	}
	/**
	 * @param cat the cat to set
	 */
	protected void setCat(String cat) {
		this.cat = cat;
	}
	/**
	 * @return the subcat
	 */
	protected String getSubcat() {
		return subcat;
	}
	/**
	 * @param subcat the subcat to set
	 */
	protected void setSubcat(String subcat) {
		this.subcat = subcat;
	}
	/**
	 * @return the lemma
	 */
	protected String getLemma() {
		return lemma;
	}
	/**
	 * @param lemma the lemma to set
	 */
	protected void setLemma(String lemma) {
		this.lemma = lemma;
	}
	/**
	 * @return the mph
	 */
	protected String getMph() {
		return mph;
	}
	/**
	 * @param mph the mph to set
	 */
	protected void setMph(String mph) {
		this.mph = mph;
	}
	
	private String word = "";
	private String cat = "";
	private String subcat = "";
	private String lemma = "";
	private String mph = "";
	
	

	/**
	 * 
	 * @param e
	 * @return
	 */
	static WordAttributes element2wordAttributes(Element e) {
		WordAttributes currentSingleWordOccAttributes = new WordAttributes();

		String word = e.getTextContent();
		String cat = e.getAttribute(FTBXMLSchema.CAT_ATTRIBUTE);
		String subcat = e.getAttribute(FTBXMLSchema.SUBCAT_ATTRIBUTE);
		String lemma = e.getAttribute(FTBXMLSchema.LEMMA_ATTRIBUTE);
		String mph = e.getAttribute(FTBXMLSchema.MPH_ATTRIBUTE);

		currentSingleWordOccAttributes.setWord(word == null ? "" : word);
		currentSingleWordOccAttributes.setCat(cat == null ? "" : cat);
		currentSingleWordOccAttributes.setSubcat(subcat == null ? "" : subcat);
		currentSingleWordOccAttributes.setLemma(lemma == null ? "" : lemma);
		currentSingleWordOccAttributes.setMph(mph == null ? "" : mph);

		return currentSingleWordOccAttributes;

	}
}